<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<head>
<meta charset="UTF-8">
<%@ include file="/common/taglibs.jsp" %>	
</head>
<body>
	<div class="easyui-panel" border=false style="padding: 10px 20px">
		<form id="fid" class="easyui-form" method="post"
			data-options="novalidate:true" action="${ctx }/SysRole/save">
			<input type="hidden" name="id" value="${vo.id}" /> 
			<input type="hidden" name="uids" id="uids" value="${vo.uids}" />
			<div class="unit">
				<label style="text-align:right;width: 60px">角色名称：</label> <input
					class="easyui-textbox" type="text" name="name" value="${vo.name}"
					data-options="required:true, width:'300px'"></input>
			</div>
			<div class="unit">
				<label style="text-align:right;width: 60px">描述：</label> <input class="easyui-textbox"
					type="text" name="remark" value="${vo.remark}"
					data-options=" width:'300px'"></input>
			</div>
			<div class="unit">
				<label style="text-align:right;width: 60px">系统标示：</label> <input
					class="easyui-textbox" type="text" name="flag" value="${vo.flag}"
					data-options=" width:'300px'"></input>
			</div>
			<div class="unit">
				<label style="text-align:right;width: 60px">人员：</label> <input class="easyui-textbox"
					name="users.name" id="unames"
					data-options="multiline:true,readonly:true"
					style="height: 60px; width: 300px" value="${vo.names}">
					</input> <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add'" onclick="showWin('winselect','${ctx }/SystemUser/sysUserSelect')">添加</a> 
					</input> <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" onclick="clearUser()">清除</a>
			</div>
		</form>
		<div style="text-align: center; padding: 10px">
			<a href="javascript:void(0)" class="easyui-linkbutton"
				iconCls="icon-save" onclick="submitForm('fid','dg','win')">提交</a> <a
				href="javascript:void(0)" class="easyui-linkbutton"
				iconCls="icon-cancel" onclick="clearForm('win')">取消</a>
		</div>

	</div>
	<script>
	    function clearUser(){
	    	$('#uids').val("");
	    	$('#unames').textbox("clear");
	    }
		function userSelectfun(rows) {
			var ids = $('#uids').val();
			var names = $('#unames').textbox("getValue");
			if (ids != ""){
				ids +=  ",";
				names +=  ",";
			};
			for (var i = 0; i < rows.length; i++) {
				if (ids.indexOf(","+rows[i].czyid+",") < 0
						&& names.indexOf(rows[i].xm) < 0) {
					ids += rows[i].czyid + ","
					names += rows[i].xm + ","
				}
			};
			ids = ids.substr(0, ids.length - 1);
			names = names.substr(0, names.length - 1);
			if (ids != "") {
				$('#uids').val(ids);
				$('#unames').textbox("setValue", names);
			};
			showMsg("系统提示", "添加成功，保存后生效！");
			$('#winselect').window('close');
		}
	</script>
</body>

